<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace App\Controller;

use App\Interface\TestServiceInterface;
use Hyperf\Context\ApplicationContext;
use Hyperf\HttpServer\Annotation\AutoController;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

#[AutoController]
class IndexController extends AbstractController
{
    private TestServiceInterface $testService;

    /**
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __construct()
    {
        $this->testService = ApplicationContext::getContainer()->get(TestServiceInterface::class);
    }

    public function index(): array
    {
        return $this->testService->test();
    }

    public function test(): array
    {
        return $this->testService->getConfig();
    }
}
